package com.gr.experimental.model.impl;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.gr.experimental.model.MFrag;
import com.gr.experimental.model.MTheory;
import com.gr.experimental.model.UID;

class MTheoryImpl implements MTheory {

	private List<MFrag> mfrags;

	private List<UID> uids;
	
	private Map<String, UID> aliases;


	public MTheoryImpl(List<MFrag> mfrags, List<UID> uids, Map<String, UID> aliases) {
		this.mfrags = new ArrayList<MFrag>(mfrags);
		this.uids = new ArrayList<UID>(BuiltInElementsImpl.UIDS);
		this.uids.addAll(uids);
		this.aliases = new HashMap<String, UID>(BuiltInElementsImpl.ALIASES);
		this.aliases.putAll(aliases);
		// TODO add prevention from alias or uid overriding
		// TODO check uniqueness
	}
	
	/**
	 * {@inheritDoc}
	 * @see com.gr.experimental.model.MTheory#getMfrags()
	 */
	public List<MFrag> getMfrags() {
		return this.mfrags;
	}

	/**
	 * {@inheritDoc}
	 * @see com.gr.experimental.model.MTheory#getAliases()
	 */
	@Override
	public Map<String, UID> getAliases() {
		return Collections.unmodifiableMap(aliases);
	}

	/**
	 * {@inheritDoc}
	 * @see com.gr.experimental.model.MTheory#getUIDs()
	 */
	@Override
	public List<UID> getUIDs() {
		return Collections.unmodifiableList(uids);
	}
	
}
